#pragma once
#include <cstdio>
#include <iostream>
#include <string>
#include <string.h>
#include <arpa/inet.h>
#include <netinet/in.h>

// #pragma once

// #include <arpa/inet.h>
// #include <netinet/in.h>
// #include <string>
class InetAddress
{
public:
    explicit InetAddress(uint16_t port=0, std::string Ip="127.0.0.1");
    explicit InetAddress(const sockaddr_in addr);
    int16_t toPort() const;
    std::string toIp() const;
    std::string toIpPort() const;
    const sockaddr_in *getSockAddr() const;
    void setSockAddr(const sockaddr_in addr) { addr_ = addr; }

private:
    sockaddr_in addr_;
};